package com.zhuzhe.blog.category.api;


import com.zhuzhe.blog.base.JsonData;
import com.zhuzhe.blog.base.ResponseData;
import com.zhuzhe.blog.category.entity.Category;
import com.zhuzhe.blog.category.responseVo.CategoryLabelListVo;
import com.zhuzhe.blog.category.service.ICategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description
 * @author: u53
 * @create: 2020-09-29 14:53
 **/

@Api(value="分类管理接口", description = "无需通过身份验证即可访问接口")
@RequestMapping("/api/category")
@RestController
public class ApiCategoryController {

    @Autowired
    private ICategoryService categoryService;

    @ApiOperation("获取正常状态的分类信息")
    @GetMapping("/list")
    public ResponseData<List<Category>> findAllNormal() {
        return JsonData.success( categoryService.findAllNormal());
    }


    @ApiOperation("获取正常状态的分类和分类下得标签信息")
    @GetMapping("/label/list")
    public ResponseData<List<CategoryLabelListVo>> findCategoryAndLabel(){
        return categoryService.findCategoryAndLabel();
    }

}
